<%-- 
    Document   : index1
    Created on : May 22, 2012, 11:06:00 PM
    Author     : home
--%>

<%@page import="java.util.Iterator"%>
<%@page import="java.util.Set"%>
<%@page import="java.util.List"%>
<%@page import="aptech.entities.Activity"%>
<%@page import="java.util.HashMap"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <link rel="stylesheet" type="text/css" media="screen" href="css/css-table.css" />
        <script type="text/javascript" src="js/jquery-1.2.6.min.js"></script>
        <script type="text/javascript" src="js/style-table.js"></script>
    </head>
    <body>
        <h1> I have been invoked by</h1>
        <table border="0" cellpadding="10" id="travel">
            <thead>
                <tr>
                    <th scope="col" >Take place on date</th>
                    <th scope="col" >Title</th>
                    <th scope="col" >Topic</th>
                    <th scope="col" >Time Duration</th>
                    <th scope="col" >Location - Slot</th>
                    <th scope="col" >Current student</th>
                    <th scope="col" >Status</th>
                </tr>
            </thead>
            <%
                        //out.print(request.getAttribute("listactivity").toString());
                        HashMap<String, List<Activity>> map = (HashMap<String, List<Activity>>) request.getAttribute("listactivity");
                        Set<String> keys = map.keySet();
                        for (Iterator i = keys.iterator(); i.hasNext();) {
                            String key = (String) i.next();
                            List<Activity> listvalue = map.get(key);
                            for (int j = 0; j < listvalue.size(); j++) {
                                if (j == 0) {%>
            <tr>
                <th scope="row" rowspan=<%=listvalue.size()%>><%=key%>  </th>
                <td ><%=listvalue.get(j).getTitleActivity()%>  </td>
                <td ><%=listvalue.get(j).getTypeOfActivity().getTypeActivityName()%>  </td>
                <td ><%=listvalue.get(j).getTimeDuaration()%>  </td>
                <td ><%=listvalue.get(j).getLocaltion()%>  </td>
                <td ><%=listvalue.get(j).getCurrentPeople()%>  </td>
                <td ><%=listvalue.get(j).getStatusOfActivity()%>  </td>
            </tr>
            <%
                                        } else {
            %>
            <tr>
                <td ><%=listvalue.get(j).getTitleActivity()%>  </td>
                <td ><%=listvalue.get(j).getTypeOfActivity().getTypeActivityName()%>  </td>
                <td ><%=listvalue.get(j).getTimeDuaration()%>  </td>
                <td ><%=listvalue.get(j).getLocaltion()%>  </td>
                <td ><%=listvalue.get(j).getCurrentPeople()%>  </td>
                <td ><%=listvalue.get(j).getStatusOfActivity()%>  </td>
            </tr>
            <%
                                }
                            }
                        }
            %>

        </table>
    </body>
</html>
